IF EXISTS(SELECT * FROM sys.objects o WHERE o.[object_id]= OBJECT_ID('Usp_OrderItemAdd') AND o.[type]=N'P')
BEGIN
	DROP PROC Usp_OrderItemAdd
END
GO
CREATE PROCEDURE  Usp_OrderItemAdd(
	@OrderInfoGuid NVARCHAR(50),
	@ProductGuid UNIQUEIDENTIFIER,
	@Attributes NVARCHAR(250),
	@ExtensionAttriutes NVARCHAR(250),
	@BuyNumber INT,
	@BuyPrice DECIMAL(18,2),
	@IsJoinActivity int,
	@IsPresent INT
)
AS

			INSERT INTO ShopNum1_OrderProduct
			(	Guid,OrderInfoGuid,ProductGuid,Name,RepertoryNumber,BuyNumber,
				MarketPrice,ShopPrice,BuyPrice,Attributes,IsShipment,IsReal,ExtensionAttriutes,
				ParentGuid,IsJoinActivity,IsPresent,CreateTime,DetailedSpecifications,
				UsedScore,ArrivedWithMoney
			)
			SELECT	NEWID(),@OrderInfoGuid,@ProductGuid,NAME,RepertoryNumber,@BuyNumber,
					MarketPrice,ShopPrice,@BuyPrice,@Attributes,0,IsReal,@ExtensionAttriutes,
					NULL,@IsJoinActivity,@IsPresent,GETDATE(),[Description],0,0
			FROM ShopNum1_Product 
			WHERE Guid=@ProductGuid